﻿@model LoginModel
@{
    Layout = null;
}
 
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>Login เข้าสู่ระบบ</title>
		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	    <link href="~/Content/Images/Icon/KPIS logo.ico" rel="shortcut icon" type="image/x-icon" />
        @*@if(BrowserVersion.IeVersion > 8)
        {
        <meta http-equiv="x-ua-compatible" content="IE=8">
        }*@
	<!--basic styles-->
<link href="~/Content/Ace/assets/css/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/font-awesome.min.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/datepicker.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/daterangepicker.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/chosen.css" rel="stylesheet" />
<link href="~/Content/Ace/assets/css/prettify.css" rel="stylesheet" />
<!--[if IE 7]>
	<link rel="stylesheet" href="~/Content/Ace/assets/css/font-awesome-ie7.min.css" />
<![endif]-->
<!--page specific plugin styles--> 
	
<!--fonts-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300" />
<!--ace styles-->
<link rel="stylesheet" href="~/Content/Ace/assets/css/ace.min.css" />
<link rel="stylesheet" href="~/Content/Ace/assets/css/ace-responsive.min.css" />
<link rel="stylesheet" href="~/Content/Ace/assets/css/ace-skins.min.css" />
<!-- gerp stylesheet -->
<link rel="stylesheet" href="~/Content/Site.css" />
<!--[if lte IE 8]>
	<link rel="stylesheet" href="~/Content/Site-ie.css" />
	<link rel="stylesheet" href="~/Content/Ace/assets/css/ace-ie.min.css" />
<![endif]-->


	</head>

	<body class="login-layout loginlayout-additional">
        <div class="container-fluid" id="main-container">
            <div id="main-content">
                <div>

                    <div class="row-fluid">
                        <div class="left">
                            <div class="span4 right" style="text-align: right;">
                                <img src="@Url.Content(GimsConfigReader.LoginLogoPath)" style="margin-top: 11px" />
                            </div>
                            <div class="span8" style="margin-left: 0px;">
                                <h1 class="loginlayout-title">
                                    @*i class="icon-white icon-inbox"></i>*@
                                    <span class="red" style="vertical-align: text-bottom">
                                        @GimsConfigReader.LoginMainTitle
                                    </span>
                                </h1>
                                <h4 class="blue loginlayout-subTitle">@GimsConfigReader.LoginSubTitle</h4>
                                <h5 class="pink" style="margin-top: 1px; font-style: italic">@GimsConfigReader.LoginThirdTitle</h5>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span12">
                        <div class="login-container">
                            <br />
                            <br />
                            <br />
                            <div class="space-6"></div>

                            <div class="row-fluid">
                                <div class="position-relative">
                                    <div id="login-box" class="visible widget-box no-border">@*class="visible widget"*@

                                        <div class="widget-body">
                                            <div class="widget-main">
                                                <h4 class="header blue lighter bigger">
                                                    <i class="icon-hand-right"></i>
                                                    กรอกข้อมูลเพื่อเข้าระบบ
                                                </h4>
                                                <div class="space-6"></div>

                                                @using (Html.BeginForm("Login", "Home", FormMethod.Post, new Dictionary<string, object>{{"autocomplete","off"}}))
                                                {
                
                                                    @Html.AntiForgeryToken()
    
                                                    <label>
                                                        <span class="block input-icon input-icon-right">
                                                            @Html.TextBoxFor(m => m.UserName, new { @class = "span12", @placeholder = "รหัสประจำตัว" })
                                                            @* <input type="text" class="span12" placeholder="Username" /> *@
                                                            <i class="icon-user"></i>
                                                        </span>
                                                    </label>

                                                    <label>
                                                        <span class="block input-icon input-icon-right">
                                                            @Html.PasswordFor(m => m.Password, new { @class = "span12", @placeholder = "รหัสผ่าน" })
                                                            @*<input type="password" class="span12" placeholder="Password" />*@
                                                            <i class="icon-lock"></i>
                                                        </span>
                                                    </label>
                                                        
                                                    if (ViewData.ModelState.IsValid == false)
                                                    {

                                                    <div class="alert alert-error">
                                                        <button type="button" class="close" data-dismiss="alert">
                                                            <i class="icon-remove"></i>
                                                        </button>
                                                        <strong>
                                                            <i class="icon-remove"></i>
                                                            ไม่สามารถเข้าใช้ระบบได้
                                                        </strong>
                                                        @Html.ValidationSummary()
                                                    </div>
                                                    }

                                                    <div class="space"></div>

                                                    <div class="row-fluid">
                                                        @*<label class="span8">
                                                            <input type="checkbox" name="RememberMeChb" id="RememberMeChb" />
                                                            <span class="lbl">ลงชื่อเข้าใช้อัตโนมัติ</span>
                                                        </label>*@

                                                        <button class="span12 btn btn-small btn-primary" onclick="submit()">
                                                            <i class="icon-key"></i>
                                                            เข้าใช้
                                                        </button>
                                                    </div>
            }
                                            </div>
                                            <!--/widget-main-->

                                            @*<div class="toolbar clearfix">
                                                <div>
                                                    <a href="#" onclick="show_box('forgot-box'); return false;" class="forgot-password-link">
                                                        <i class="icon-arrow-left"></i>
                                                        ลืมรหัสผ่าน
                                                    </a>
                                                </div>
                                            </div>*@
                                        </div>
                                        <!--/widget-body-->
                                    </div>
                                    <!--/login-box-->

                                    <div id="forgot-box" class="widget-box no-border">
                                        <div class="widget-body">
                                            <div class="widget-main">
                                                <h4 class="header red lighter bigger">
                                                    <i class="icon-key"></i>
                                                    รับข้อมูลรหัสผ่าน
                                                </h4>

                                                <div class="space-6"></div>
                                                <p>
                                                    กรอกอีเมล์ที่ใช้รับข้อมูลรหัสผ่าน
                                                </p>

                                                <form>
                                                    <label>
                                                        <span class="block input-icon input-icon-right">
                                                            <input type="email" class="span12" placeholder="Email" />
                                                            <i class="icon-envelope"></i>
                                                        </span>
                                                    </label>

                                                    <div class="row-fluid">
                                                        <button onclick="return false;" class="btn btn-small btn-danger">
                                                            <i class="icon-lightbulb"></i>
                                                            ส่งมายังฉัน!
                                                        </button>
                                                    </div>
                                                </form>
                                            </div>
                                            <!--/widget-main-->

                                            <div class="toolbar center">
                                                <a href="#" onclick="show_box('login-box'); return false;" class="back-to-login-link">กลับหน้าเข้าใช้ระบบ
													<i class="icon-arrow-right"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <!--/widget-body-->
                                    </div>
                                    <!--/forgot-box-->
                                </div>
                                <!--/position-relative-->
                            </div>
                        </div>
                    </div>
                    <!--/span-->
                </div>
                <!--/row-->
            </div>

            <div style="margin-top: 420px;"></div>

            <!-- Permanent disable feature (Easy login on developing)-->
            @* 
                @if (false)
                {
                    <div style="background-color: white; border: none; float: left">

                        @{
                    // บอกเวอร์ชั่นของ Code เพื่อใช้ในการเทสระบบ
                    var entryAssembly = typeof(KPIS.GERP.WEB.GIMS.Class.GimsConfigReader).Assembly; //System.Reflection.Assembly.GetEntryAssembly();
                    var fileInfo = new FileInfo(entryAssembly.Location);
                    var buildDate = fileInfo.LastWriteTime;
                    //!- บอกเวอร์ชั่นของ Code เพื่อใช้ในการเทสระบบ
                        }

                        <span><strong>Developer help zone: </strong></span>
                        <div style="text-align: right; float: right">(Version date @buildDate)</div>

                        <hr />

                        @{
                            var s2 = new KPIS.GERP.WEB.GIMS.UserService.UserServiceClient();
                            var u = s2.GetUsers().Where(o => o.RecordStatus != "D");
                            foreach (var us in u)
                            {
                            <a href="@Url.Action("SingleSigonRawData", new
                                             {
                                                 username = us.Code,
                                                 password = us.Password,
                                                 redirectPage = ""
                                             })" 
                                   class='alert @(us.Employee == null ? "alert-error" : "alert-info")' style="width: 250px; float: left; margin-right: 10px; height: 200px;">
                                <span style="font-size: smaller">UserName:</span> @us.Code
                                <br />
                                <span style="font-size: smaller">ชื่อ:</span> @(us.Employee != null ? us.Employee.FullName : "(ไม่มีข้อมูลพนักงาน)")
                                <br />
                                <span style="font-size: smaller">
                                    @{
                                var positionName = us.Employee != null && us.Employee.Position != null && us.Employee.Position.Name != null ? us.Employee.Position.Name : "";
                                positionName = positionName.Substring(0, Math.Min(44, positionName.Length));

                                var jobsiteName = us.Employee != null && us.Employee.JobSite != null ? us.Employee.JobSite.Name : "(ไม่มีข้อมูลหน่วยงาน)";
                                var role = GimsMembership.GetRoleOfUser(us.Code);
                                    }
                                    EmpSeq: @(us.Employee != null ? us.Employee.EmpId.ToString() : "null")&nbsp;&nbsp;&nbsp;
                                        IsAdmin: @us.IsAdmin.ToString()<br />
                                    ตำแหน่ง: <span class="muted">@positionName</span><br />
                                    สังกัด: <span class="muted">@jobsiteName</span><br />
                                    Role: <span class="text-error">@((role ?? "").Replace(",", ", "))</span>
                                </span>
                            </a>
                            }
                        }

                    </div>
            }*@
        </div><!--/.fluid-container-->

        <!--basic scripts-->

		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
		<script type="text/javascript">
			window.jQuery || document.write("<script src='Content/Ace/assets/js/jquery-1.9.1.min.js'>" + "<" + "/script>");
		</script>
        
        
        <!--For alert close-->
        
        <script src="~/Content/Ace/assets/js/bootstrap.min.js"></script> 
        <script src="~/Content/Ace/assets/js/bootstrap-datepicker.min.js"></script>
        <script src="~/Content/Ace/assets/js/chosen.jquery.min.js"></script>
        <script src="~/Content/Ace/assets/js/jquery.dataTables.min.js"></script>
        <script src="~/Content/Ace/assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="~/Content/Ace/assets/js/ace-elements.min.js"></script>
        <script src="~/Content/Ace/assets/js/ace.min.js"></script>
        <script src="~/Content/Ace/assets/js/date-time/bootstrap-datepicker.js"></script>
        <script src="~/Content/Ace/assets/js/date-time/bootstrap-datepicker-thai.js"></script>
        <script src="~/Content/Ace/assets/js/date-time/locales/bootstrap-datepicker.th.js"></script>
        <script src="~/Content/Ace/assets/js/uncompressed/bootbox.js"></script>

         
        <!-- End -->
        
        

        <!--page specific plugin scripts-->

		<!--inline scripts related to this page-->

        <script type="text/javascript">
            function show_box(id) {
                $('.widget-box.visible').removeClass('visible');
                $('#' + id).addClass('visible');
            }

            window.onload = function () {
                document.getElementById("UserName").focus();
            };  
		</script>

    </body>
</html>
